from django.db import models
from utils.base_models import BaseModel


class Ext_MethodModel(BaseModel):
    name = models.CharField(verbose_name='方法名称', blank=False, null=False, max_length=256)
    method_choice = (
        (True, '内置'),
        (False, '自定义')
    )
    ext_method_type = models.BooleanField(choices=method_choice, default=False, null=False, blank=False, verbose_name='是否内置方法')
    ext_method = models.CharField(null=False, blank=False, max_length=256, verbose_name='扩展方法')
    ext_method_desc = models.CharField(null=True, blank=True, max_length=256, verbose_name='扩展方法说明')
    args_desc = models.CharField(null=True, blank=True, max_length=256, verbose_name='参数说明')
    res_value_desc = models.CharField(null=True, blank=True, max_length=256, verbose_name='返回值说明')

    class Meta:
        db_table = 'http_method'
        verbose_name = '扩展方法'
        verbose_name_plural = verbose_name
        ordering = ('-create_time', )

    def __str__(self):
        return self.name
